import axios from '@/utils/request'

// 获取用户频道列表
export const getUserTabs = () => {
  return axios({
    method: 'get',
    url: '/v1_0/user/channels'
  })
}

// 获取所有频道列表
export const getAllChannels = () => {
  return axios({
    method: 'get',
    url: '/v1_0/channels'
  })
}

// 修改用户频道
export const updateUserChannels = (tabs) => {
  tabs = tabs.filter(val => val.id !== 0)
  tabs = tabs.map((val, index) => { return { id: val.id, seq: index } })
  return axios({
    method: 'put',
    url: `/v1_0/user/channels`,
    data: {
      channels: tabs
    }
  })
}
